 c='';
 b='';
 function entrust_in(e) {
		 	one_price_in=document.getElementById("one_price_in").value;
		 	if(e!='')
		 	 {
		 	 num=(Number(one_price_in)*Number(e)).toFixed(2);
			 document.getElementById("sum_price_in").value=num;
			 }else{
			 document.getElementById("sum_num_in").value=0;
			 document.getElementById("sum_price_in").value=0;
             }
             c=e;
              if(b != ''&& c!='') {
					document.getElementById('submit_toin').style.background="#4782DB";
				}else{
					document.getElementById('submit_toin').style.background="#E6E6E6";
				}
}
 function entrust_in2(e) {
             b=e;
             if(b != ''&& c!='') {
					document.getElementById('submit_toin').style.background="#4782DB";
				}else{
					document.getElementById('submit_toin').style.background="#E6E6E6";
				}
 }
 d='';
 f='';
 function entrust_out(e) {
		 	one_price_out=document.getElementById("one_price_out").value;
		 	if(e!='')
		 	 {
		 	 num=(Number(one_price_out)*Number(e)).toFixed(2);
			 document.getElementById("sum_price_out").value=num;
			 }else{
			 document.getElementById("sum_num_out").value=0;
			 document.getElementById("sum_price_out").value=0;
             }
              d=e;
              if(d!= ''&& f!='') {
					document.getElementById('submit_toout').style.background="#4782DB";
				}else{
					document.getElementById('submit_toout').style.background="#E6E6E6";
				}
}
 function entrust_out2(e) {
             f=e;
             if(d != ''&& f!='') {
					document.getElementById('submit_toout').style.background="#4782DB";
				}else{
					document.getElementById('submit_toout').style.background="#E6E6E6";
				}
 }

function Check_full_01(){

        for(var i=0;i<document.form1.elements.length-1;i++)
        {
         if(document.form1.elements[i].value=="")
         {
           alert("请填写完整");
           document.form1.elements[i].focus();           
           return false;
         }
        }
        return true;       
}

function Check_full_02(){

        for(var i=0;i<document.form2.elements.length-1;i++)
        {
         if(document.form2.elements[i].value=="")
         {
           alert("请填写完整");
           document.form2.elements[i].focus();
           return false;
         }
        }
        return true;       
}

function Check_full_03(){

        for(var i=0;i<document.form3.elements.length-1;i++)
        {
         if(document.form3.elements[i].value=="")
         {
           alert("请填写完整");
           document.form3.elements[i].focus();
           return false;
         }
        }
        return true;       
}

function Check_full_04(){

        for(var i=0;i<document.form4.elements.length-1;i++)
        {
         if(document.form4.elements[i].value=="")
         {
           alert("请填写完整");
           document.form4.elements[i].focus();
           return false;
         }
        }
        return true;       
}


      var h = '';
      var i = '';
      var j = '';
      var k = '';
      function chadnge(e) {
        h = e;
        if(h != '' && i != '' && j != ''&& k != '') {
          document.getElementById('btn').style.background="#4782DB";
        }else{
          document.getElementById('btn').style.background="#E6E6E6";
        }
      }
 
      function chadnge2(e) {
        i = e;
          if(h != '' && i != ''&& j != ''&& k != '') {
          document.getElementById('btn').style.background="#4782DB";
        }else{
          document.getElementById('btn').style.background="#E6E6E6";
        }
      }
      function chadnge3(e) {
        j = e;
          if(h != '' && i != ''&& j != ''&& k != '') {
          document.getElementById('btn').style.background="#4782DB";
        }else{
          document.getElementById('btn').style.background="#E6E6E6";
        }
      }
      function chadnge4(e) {
        k = e;
          if(h != '' && i != ''&& j != ''&& k != '') {
          document.getElementById('btn').style.background="#4782DB";
        }else{
          document.getElementById('btn').style.background="#E6E6E6";
        }
      }
function trim(str){ //删除左右两端的空格
    return str.replace(/(^\s*)|(\s*$)/g, "");
}
function Check_login_form(){    
        var account = document.getElementById("account");
        var password = document.getElementById("password");
        if(trim(account.value)==null || trim(account.value)==""){
            alert("请输入用户名");
            account.focus();
            return false;
        }
        if(trim(password.value)==null || trim(password.value)==""){
            alert("请输入密码");
            password.focus();
            return false;
        }
        return true;
}
function Check_attestation_form(){
        var name = document.getElementById("name");
        var papers_id = document.getElementById("papers_id");
        var bank_host = document.getElementById("bank_host");
        var bank_branch = document.getElementById("bank_branch");
        var bankcard_id = document.getElementById("bankcard_id");
        var code = document.getElementById("code");
        var file1 = document.getElementById("file1");
        var file2 = document.getElementById("file2");
        var file3 = document.getElementById("file3");

        /*验证身份证号码*/
      var CheckIdCard={
        //Wi 加权因子 Xi 余数0~10对应的校验码 Pi省份代码
        Wi:[7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2],
        Xi:[1,0,"X",9,8,7,6,5,4,3,2],
        Pi:[11,12,13,14,15,21,22,23,31,32,33,34,35,36,37,41,42,43,44,45,46,50,51,52,53,54,61,62,63,64,65,71,81,82,91],
 
        //检验18位身份证号码出生日期是否有效
        //parseFloat过滤前导零，年份必需大于等于1900且小于等于当前年份，用Date()对象判断日期是否有效。
        brithday18:function(sIdCard){
            var year=parseFloat(sIdCard.substr(6,4));
            var month=parseFloat(sIdCard.substr(10,2));
            var day=parseFloat(sIdCard.substr(12,2));
            var checkDay=new Date(year,month-1,day);
            var nowDay=new Date();
            if (1900<=year && year<=nowDay.getFullYear() && month==(checkDay.getMonth()+1) && day==checkDay.getDate()) {
                return true;
            };
        },
 
        //检验15位身份证号码出生日期是否有效
        brithday15:function(sIdCard){
            var year=parseFloat(sIdCard.substr(6,2));
            var month=parseFloat(sIdCard.substr(8,2));
            var day=parseFloat(sIdCard.substr(10,2));
            var checkDay=new Date(year,month-1,day);
            if (month==(checkDay.getMonth()+1) && day==checkDay.getDate()) {
                return true;
            };
        },
 
        //检验校验码是否有效
        validate:function(sIdCard){
            var aIdCard=sIdCard.split("");
            var sum=0;
            for (var i = 0; i < CheckIdCard.Wi.length; i++) {
                sum+=CheckIdCard.Wi[i]*aIdCard[i]; //线性加权求和
            };
            var index=sum%11;//求模，可能为0~10,可求对应的校验码是否于身份证的校验码匹配
            if (CheckIdCard.Xi[index]==aIdCard[17].toUpperCase()) {
                return true;
            };
        },
 
        //检验输入的省份编码是否有效
        province:function(sIdCard){
            var p2=sIdCard.substr(0,2);
            for (var i = 0; i < CheckIdCard.Pi.length; i++) {
                if(CheckIdCard.Pi[i]==p2){
                    return true;
                };
            };
        }
    };


      if(trim(name.value)==null || trim(name.value)==""){
            alert("请输入姓名");
            name.focus();
            return false;
        }
        sIdCard=trim(papers_id.value);
        if(trim(papers_id.value)==null || trim(papers_id.value)==""){
            alert("请输入证件号码");
            papers_id.focus();
            return false;
        }else if(trim(papers_id.value).length!=18 && trim(papers_id.value).length!=15){
            alert("请输入有效的身份件号码");
            papers_id.focus();
            return false;
        }else if (trim(papers_id.value).length==18) {
           if (!(CheckIdCard.province(sIdCard)&&CheckIdCard.brithday18(sIdCard)&&CheckIdCard.validate(sIdCard))) {
                alert("请输入有效的身份证号码1");
                papers_id.focus();
                return false;
            }
        }else if (sIdCard.length==15) {
            if (!(CheckIdCard.province(sIdCard)&&CheckIdCard.brithday15(sIdCard))) {
               alert("请输入有效的身份证号码");
                papers_id.focus();
                return false;
            }
       }

      if(trim(bank_host.value)==null || trim(bank_host.value)==""){
            alert("请输入开户银行");
            bank_host.focus();
            return false;
        }

        if(trim(bank_branch.value)==null || trim(bank_branch.value)==""){
            alert("请输入开户支行");
            bank_branch.focus();
            return false;
        }

        if(trim(bankcard_id.value)==null || trim(bankcard_id.value)==""){
            alert("请输入银行卡号");
            bankcard_id.focus();
            return false;
        }

        if(trim(code.value)==null || trim(code.value)==""){
            alert("请输入验证码");
            code.focus();
            return false;
        }

        if(trim(file1.value)==null || trim(file1.value)==""){
            alert("请上传身份证正面照");
            return false;
        }

        if(trim(file2.value)==null || trim(file2.value)==""){
            alert("请上传身份证反面照");
            return false;
        }

        if(trim(file3.value)==null || trim(file3.value)==""){
            alert("请上传身份证手持照");
            return false;
        }

        return true;
}

/*验证绑定邮箱*/
function Check_bindemail_form(){
        var password = document.getElementById("password");
        var email = document.getElementById("email");
         var code = document.getElementById("code");
         var reg = new RegExp("^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$"); 
        if(trim(password.value)==null || trim(password.value)==""){
            alert("请输入登录密码");
            password.focus();
            return false;
        }
        if(trim(email.value)==null || trim(email.value)==""){
            alert("请输入邮箱");
            email.focus();
            return false;
        }else if(!reg.test(trim(email.value))){
            alert("邮箱格式不正确！");
            email.focus();
            return false;
        }
        if(trim(code.value)==null || trim(code.value)==""){
            alert("请输入验证码");
            code.focus();
            return false;
        }
        return true;
}


/*验证修改登录密码和交易密码*/
function Check_editpsw_form(){
        var password = document.getElementById("password");
        var code = document.getElementById("code");   
        var newpassword = document.getElementById("newpassword");
        var check = document.getElementById("check"); 
  
        if(trim(password.value)==null || trim(password.value)==""){
            alert("请输入登录密码");
            password.focus();
            return false;
        }
        if(trim(code.value)==null || trim(code.value)==""){
            alert("请输入验证码");
            code.focus();
            return false;
        }
        if(trim(newpassword.value)==null || trim(newpassword.value)==""){
            alert("请输入新修改密码");
            newpassword.focus();
            return false;
        }
        if(trim(check.value)==null || trim(check.value)==""){
            alert("请输入密码确认");
            check.focus();
            return false;
        }
        if (trim(newpassword.value)!=trim(check.value)) {
           alert("两次输入密码不相同");
            check.focus();
            return false;
        }
        return true;
}

/*验证修改手机号码*/

function Check_edittel_form(){
        var password = document.getElementById("password");
        var code = document.getElementById("code");   
        var tel = document.getElementById("tel");
        var checktel = document.getElementById("checktel"); 
  
        if(trim(password.value)==null || trim(password.value)==""){
            alert("请输入登录密码");
            password.focus();
            return false;
        }
        if(trim(code.value)==null || trim(code.value)==""){
            alert("请输入验证码");
            code.focus();
            return false;
        }
        if(trim(tel.value)==null || trim(tel.value)==""){
            alert("请输入新手机号码");
            tel.focus();
            return false;
        }else if (!(/^1[34578]\d{9}$/.test(trim(tel.value)))) {
            alert("手机号格式不正确");
            tel.focus();
            return false;
        }
        if(trim(checktel.value)==null || trim(checktel.value)==""){
            alert("手机号码确认");
            checktel.focus();
            return false;
        }

        if (trim(tel.value)!=trim(checktel.value)) {
           alert("两次输入手机号码不相同");
            checktel.focus();
            return false;
        }
        return true;
}

/*忘记密码*/

function  Check_forgpswt_form(){
        var accountt = document.getElementById("accountt");
        var codet = document.getElementById("codet");   
        var tel = document.getElementById("tel");
        var checkt = document.getElementById("checkt"); 
        var newpasswordt = document.getElementById("newpasswordt");

        if(trim(accountt.value)==null || trim(accountt.value)==""){
            alert("请输入账户");
            accountt.focus();
            return false;
        }

        if(trim(tel.value)==null || trim(tel.value)==""){
            alert("请输入手机号码");
            tel.focus();
            return false;
        }else if (!(/^1[34578]\d{9}$/.test(trim(tel.value)))){
            alert("手机号格式不正确");
            tel.focus();
            return false;
        }
        if(trim(codet.value)==null || trim(codet.value)==""){
            alert("请输入验证码");
            codet.focus();
            return false;
        }
        if(trim(newpasswordt.value)==null || trim(newpasswordt.value)==""){
            alert("请输入新修改密码");
            newpasswordt.focus();
            return false;
        }
        if(trim(checkt.value)==null || trim(checkt.value)==""){
            alert("请输入密码确认");
            checkt.focus();
            return false;
        }
        if (trim(newpasswordt.value)!=trim(checkt.value)) {
           alert("两次输入密码不相同");
            checkt.focus();
            return false;
        }
        return true;
}

function  Check_forgpswe_form(){
        var accounte = document.getElementById("accounte");
        var codee = document.getElementById("codee");   
        var email = document.getElementById("email");
        var checke = document.getElementById("checke"); 
        var newpassworde = document.getElementById("newpassworde");
         var reg = new RegExp("^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$"); 
        if(trim(accounte.value)==null || trim(accounte.value)==""){
            alert("请输入账户");
            accounte.focus();
            return false;
        }
       
        if(trim(email.value)==null || trim(email.value)==""){
            alert("请输入邮箱");
            email.focus();
            return false;
        }else if(!reg.test(trim(email.value))){
            alert("邮箱格式不正确！");
            email.focus();
            return false;
        }
        if(trim(codee.value)==null || trim(codee.value)==""){
            alert("请输入验证码");
            codee.focus();
            return false;
        }
        if(trim(newpassworde.value)==null || trim(newpassworde.value)==""){
            alert("请输入新修改密码");
            newpassworde.focus();
            return false;
        }
        if(trim(checke.value)==null || trim(checke.value)==""){
            alert("请输入密码确认");
            checke.focus();
            return false;
        }
        if (trim(newpassworde.value)!=trim(checke.value)) {
           alert("两次输入密码不相同");
            checke.focus();
            return false;
        }
        return true;
}

/*注册验证*/

function Check_register_form(){
        var account = document.getElementById("account");
        var password = document.getElementById("password");   
        var pay_psw = document.getElementById("pay_psw");
        var tel = document.getElementById("tel"); 
        var email = document.getElementById("email"); 
        var code = document.getElementById("code");
        var reg = new RegExp("^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$"); 
        if(trim(account.value)==null || trim(account.value)==""){
            alert("请输入账户");
            account.focus();
            return false;
        }
        if(trim(password.value)==null || trim(password.value)==""){
            alert("请输入登录密码");
            password.focus();
            return false;
        }
        if(trim(pay_psw.value)==null || trim(pay_psw.value)==""){
            alert("请输入支付密码");
            pay_psw.focus();
            return false;
        }
        if(trim(tel.value)==null || trim(tel.value)==""){
            alert("请输入手机号码");
            tel.focus();
            return false;
        }else if (!(/^1[34578]\d{9}$/.test(trim(tel.value)))){
            alert("手机号格式不正确");
            tel.focus();
            return false;
        }

        if(trim(email.value)==null || trim(email.value)==""){
            alert("请输入邮箱");
            email.focus();
            return false;
        }else if(!reg.test(trim(email.value))){
            alert("邮箱格式不正确！");
            email.focus();
            return false;
        }
        if(trim(code.value)==null || trim(code.value)==""){
            alert("请输入验证码");
            code.focus();
            return false;
        }
        return true;
}
/*宝发送*/
function  Check_sendbao_form(){
        var to_account = document.getElementById("to_account"); 
        var address = document.getElementById("address");
        var num = document.getElementById("num");         
        var code = document.getElementById("code"); 
        var yue=document.getElementById('yue');

        if(trim(to_account.value)==null || trim(to_account.value)==""){
            alert("请输入对方账户");
            to_account.focus();
            return false;
        }
        if(trim(address.value)==null || trim(address.value)==""){
            alert("请输入钱包地址");
            address.focus();
            return false;
        }
        if(trim(num.value)==null || trim(num.value)==""){
            alert("请输入发送数量");
            num.focus();
            return false;
        }else if(parseInt(num.value)>parseInt(yue.innerText)){
            alert("发送数量不能大于余额");
            num.focus();
            return false;
        }
        if(trim(code.value)==null || trim(code.value)==""){
            alert("请输入验证码");
            code.focus();
            return false;
        }
        return true;
}